﻿<Window x:Class="LockCrypt.WinInstaller"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:loc="clr-namespace:LockCrypt"
    xmlns:props="clr-namespace:LockCrypt.Properties"
    xmlns:lex="http://schemas.root-project.org/xaml/presentation"
    xmlns:l49ui="clr-namespace:Lime49.UI;assembly=Lime49"
    xmlns:l49="clr-namespace:Lime49;assembly=Lime49"
    l49:WindowService.EscapeClosesWindow="True" WindowStartupLocation="CenterOwner" 
    Title="{lex:LocText LockCrypt.Core:Strings:InitialSetup}"
    MinHeight="300" MinWidth="350" SizeToContent="Height" 
    Height="310" Width="470"
    FocusManager.FocusedElement="{Binding ElementName=tabWizard}"
    Style="{StaticResource {x:Type Window}}" Icon="/LockCrypt;component/Resources/LockCrypt.ico">
    <Window.Resources>
        <props:Settings x:Key="settings" />
    </Window.Resources>
    <Window.CommandBindings>
        <CommandBinding Command="ApplicationCommands.Help" Executed="ShowHelp" />
    </Window.CommandBindings>
    <DockPanel Margin="6" LastChildFill="true" Grid.IsSharedSizeScope="True">
        <DockPanel DockPanel.Dock="Bottom" LastChildFill="True" MinHeight="24">
            <TextBlock x:Name="lblStatus" DockPanel.Dock="Left" Visibility="Hidden" TextTrimming="CharacterEllipsis" TextWrapping="NoWrap" Margin="2" />
            <ProgressBar x:Name="prgStatus" DockPanel.Dock="Right" IsIndeterminate="True" MinWidth="40" Visibility="Hidden" />
        </DockPanel>
        <Grid DockPanel.Dock="Bottom">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
            <Button Grid.Column="0" x:Name="btnPrevious" MinWidth="70" Click="btnPrevious_Click" Visibility="Hidden" Content="{lex:LocText LockCrypt.Core:Strings:Previous}"/>
            <Button Grid.Column="2" x:Name="btnNext" MinWidth="70" IsDefault="True" Click="btnNext_Click" Content="{lex:LocText LockCrypt.Core:Strings:Next}"/>
        </Grid>
        <TabControl DockPanel.Dock="Top" x:Name="tabWizard" DataContext="{StaticResource settings}" MinHeight="280" Background="Transparent" BorderThickness="0" SelectedIndex="0" TabIndex="1">
            <TabItem x:Name="tbStart" Height="0">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="*"/>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto" SharedSizeGroup="labels"/>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>
                    <TextBlock Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Style="{StaticResource HeadingFont}" Text="{lex:LocText LockCrypt.Core:Strings:InitialSetup}"/>
                    <TextBlock Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" TextWrapping="Wrap" Style="{StaticResource PaddedTextBlock}" Text="{lex:LocText LockCrypt.Core:Strings:ChooseLanguageToContinue}"/>
                    
                    <ListBox x:Name="lstLanguages" Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" SelectedValuePath="Key" Style="{StaticResource BigLanguagesList}"
                             MaxHeight="350" TabIndex="1" />
                </Grid>
            </TabItem>
            <TabItem x:Name="tbDatabase" Height="0">
                <StackPanel>
                    <TextBlock Style="{StaticResource HeadingFont}" Text="{lex:LocText LockCrypt.Core:Strings:Database}"/>
                    <CheckBox x:Name="chkAutoOpen" Content="{lex:LocText LockCrypt.Core:Strings:OpenPrefferedOnStartup}" IsChecked="{Binding Default.AutoOpenOnStartup,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                              VerticalAlignment="Center" VerticalContentAlignment="Center" Margin="5,2" TabIndex="2"/>
                    <StackPanel>
                        <TextBlock Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" TextWrapping="Wrap" Style="{StaticResource PaddedTextBlock}" Text="{lex:LocText LockCrypt.Core:Strings:DbModeDesc}"/>
                        <loc:DatabaseSelector x:Name="dbSelector" IsEnabled="{Binding IsChecked,ElementName=chkAutoOpen}" TabIndex="3"
                                              AvailableDatabaseModes="XML,SQLite,Legacy,MySQL" 
                                              DatabaseMode="{Binding Default.DatabaseMode,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                                              DatabasePath="{Binding Default.DatabasePath,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                                              ShowEncryption="True" CanEditEncryption="{Binding IsChecked,ElementName=chkAutoOpen}" EncryptionAlgorithm="{Binding Default.EncryptionAlgorithm,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
                    </StackPanel>
                </StackPanel>
            </TabItem>
            <TabItem x:Name="tbFinish" Height="0">
                <StackPanel>
                    <TextBlock Style="{StaticResource HeadingFont}" Text="{lex:LocText LockCrypt.Core:Strings:Finished}"/>
                    <TextBlock TextWrapping="Wrap" Style="{StaticResource PaddedTextBlock}" Text="{lex:LocText LockCrypt.Core:Strings:InstallerCompletedFriendly}"/>
                    <TextBlock TextWrapping="Wrap" Style="{StaticResource PaddedTextBlock}" Text="{lex:LocText LockCrypt.Core:Strings:FirewallAllowPrompt}"/>
                    <l49ui:Hyperlink x:Name="btnWiki" Text="{lex:LocText LockCrypt.Core:Strings:OnlineWiki}" NavigateUrl="http://wiki.lime49.com/index.php?title=LockCrypt"/>
                    <Button x:Name="btnHelpFile" Content="{lex:LocText LockCrypt.Core:Strings:HelpContents}" Click="btnClick" />
                    <GroupBox Grid.Row="2" Header="{lex:LocText LockCrypt.Core:Strings:ExampleData}">
                        <StackPanel>
                            <TextBlock TextWrapping="Wrap" Style="{StaticResource PaddedTextBlock}" Text="{lex:LocText LockCrypt.Core:Strings:DummyDataDesc}"/>
                            <CheckBox x:Name="chkExampleData" Content="{lex:LocText LockCrypt.Core:Strings:PopulateWithDummyData}" IsChecked="True"
                                      IsEnabled="{Binding IsChecked,ElementName=chkAutoOpen}"/>
                        </StackPanel>
                    </GroupBox>
                </StackPanel>
            </TabItem>
        </TabControl>
    </DockPanel>
</Window>
